<?php

Class Wishlist_Item{
	
	public $cdWishlist;
	public $cdItem;
	public $cdPlataforma;
	
	function __construct($mCdWishlist, $mCdPlataforma, $mCdItem) {

		$this->cdWishlist = $mCdWishlist;
		$this->cdItem = $mCdItem;
		$this->cdPlataforma = $mCdPlataforma;
		
	}
	
	function insereItemWishlist($mDb){
		
		try{			
			$mDb->exec('INSERT INTO wishlist_item
								  (cd_wishlist,
								   cd_item, 
								   cd_plataforma)
						VALUES ('.$this->cdWishlist.','
								 .$this->cdItem.','
								 .$this->cdPlataforma.');'
					   );						  
		} catch(Exception $e) {
			echo $e->getMessage();
		}

	}
	
	function removeItemWishlist($mDb){
		
		try{			
			$mDb->exec('DELETE FROM wishlist_item 
						WHERE cd_wishlist = '.$this->cdWishlist.' 
						AND	  cd_item = '.$this->cdItem.' 
						AND	  cd_plataforma = '.$this->cdPlataforma.';');						  
		} catch(Exception $e) {
			echo $e->getMessage();
		}

	}
	
}

Class Wishlist_Item_Cadastrado extends Wishlist_Item{
	
	public $nmPlataforma;
	public $nmItem;
	
	function __construct($queryResult){

		$this->cdWishlist = $queryResult['cd_wishlist'];
		$this->nmPlataforma = $queryResult['nm_plataforma'];
		$this->nmItem = $queryResult['nm_item'];
		$this->cdItem = $queryResult['cd_item'];
		$this->cdPlataforma = $queryResult['cd_plataforma'];
	}
}

?>